#pragma once

class IVisibleComponent;
class Direct3D9API CD3DEffect
{
public:
	CD3DEffect( const TString& EffectFileName );
	CD3DEffect( const BYTE* CompiledEffectBuffer, const int SizeOfBuffer );
	~CD3DEffect(void);

	const UINT Activate( LPCSTR techniqueName ) const;
	void Deactivate() const;
	void BeginPass( const UINT PassIndex ) const;
	void EndPass() const;

	void Render( LPCSTR techniqueName, IVisibleComponent* pComponent ) const;

	// constant accessors
	void setMatrix( LPCSTR hParameter, const D3DXMATRIX* Src );
	void setFloat( LPCSTR hParameter, FLOAT Src );
	void setTexture( LPCSTR hParameter, IDirect3DTexture9* pTexture );

private:
	BOOL _CreateEffectFromFile( const TString& EffectFileName );

private:
	ID3DXEffect*			m_pEffect;
};

